<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>3-2 Vue实例生命周期</title>
    <script src="../vue.js"></script>
</head>

<body>
    <div id="app"></div>

    <script>
        // 生命周期函数就是vue实例在某一个时间点会自动执行的函数
        var vm = new Vue({
            el: '#app',
            template: "<div>{{test}}</div>",
            data: {
                test: 'hello world'
            },
            beforeCreate() {
                console.log("beforeCreate");
            },
            created() {
                console.log("created");
            },
            beforeMount() {
                console.log(this.$el);
                console.log("beforeMount");
            },
            mounted() {
                console.log(this.$el);
                console.log("mounted");
            },
            beforeDestroy() {
                console.log("beforeDestroy");
            },
            destroyed() {
                console.log("destroyed");
            },
            beforeUpdate() {
                console.log("beforeUpdate");
            },
            updated() {
                console.log("updated");
            },
        })
    </script>
</body>

</html>